﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Caching;
using System.Web;

namespace SMS.Common.ServiceModel
{
    public class HttpMemoryCache : ICache
    {
        #region ICache 成员

        public T GetCache<T>(string key) where T : class
        {

            var obj = HttpRuntime.Cache[key];
            if (obj != null)
                return obj as T;
            else
                return null;
        }

        public void SaveToCatche(string key, object data)
        {
            AggregateCacheDependency cd = new AggregateCacheDependency();
            HttpRuntime.Cache.Add(key, data, cd, Cache.NoAbsoluteExpiration, new TimeSpan(1, 0, 0),
CacheItemPriority.High, null);
        }

        #endregion
    }
}
